package com.sixth.controller;

import com.sixth.entity.AclRole;
import com.sixth.entity.RoleVo;
import com.sixth.service.AclRoleService;
import com.sixth.service.AclUserService;
import com.sixth.until.CommonResult;
import com.sixth.until.TableResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: self-tui-education
 * @description:
 * @author: 高振杨
 * @create: 2022-04-25 15:49
 **/
@RestController
@RequestMapping("/system/role")
public class RoleController {

    @Autowired
    private AclUserService aclUserService;
    @Autowired
    private AclRoleService aclRoleService;
    @GetMapping("/findRoleByUserId/{userId}")
    public CommonResult findRoleByUserId(@PathVariable String userId){
        return aclUserService.findRoleByUserId(userId);
    }

    @PostMapping("/findRoleByRoleName/{roleCurrentPage}/{rolePageSize}")
    public TableResult findRoleByRoleName(@PathVariable Integer roleCurrentPage, @PathVariable Integer rolePageSize, @RequestBody AclRole role){
        return aclRoleService.findRoleByRoleName(roleCurrentPage,rolePageSize,role);
    }

    @PostMapping("/fenUserRole")
    public CommonResult fenUserRole(@RequestBody RoleVo roleVo){
        return aclRoleService.fenUserRole(roleVo);
    }
}
